package com.darrenchan.leetcode;

import java.util.*;

/**
 * @Desc
 * @Author chenchi03
 * @CreateTime 2020-02-17 17:04
 */
class Res {
    int m;
    int n;
    public Res(int m, int n) {
        this.m = m;
        this.n = n;
    }
}

public class Test {
    public static void main(String[] args) {
        int a = 13, b = 7;

        int m = a / b;
        int n = a % b;

        boolean flag = true;

        List<Res> list = new ArrayList<>();

        while(flag) {
            a = n * 10;

            m = a / b;
            n = a % b;


        }

        Queue<Integer> max = new PriorityQueue<>((o1, o2) -> o2 - o1);

    }

    public int scoreOfParentheses(String str) {
        Stack<String> stack = new Stack<>();

        for(int i = 0; i < str.length(); i++){
            if(str.charAt(i) == '(') {
                stack.push(str.charAt(i) + "");
            } else {
                if(stack.peek().equals("(")) {
                    stack.pop();
                    stack.push("1");
                } else {
                    int temp = 0;
                    String a = stack.pop();
                    while(!a.equals("(")) {
                        temp += Integer.parseInt(a);
                        a = stack.pop();
                    }
                    stack.push(2 * temp + "");
                }
            }
        }

        int res = 0;
        for(String c : stack) {
            res += Integer.parseInt(c);
        }

        return res;
    }

}
